package com.budwk.app.sqfwV2.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.nutz.ioc.impl.PropertiesProxy;

import java.util.Arrays;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum SqfwRallyEnums {


    WORK_PLAN(1,"工作计划表", "workPlan.xlsx","/blankStencil/rally/工作计划表.xlsx","/blankStencil/rally/preview/工作计划表.png",true),
    KEY_ACTIVITY_TASK(2,"重点活动任务清单", "priorityActivityTaskList.xlsx","/blankStencil/rally/重点活动任务清单.xlsx","/blankStencil/rally/preview/重点活动任务清单.png",true),
    MONTHLY_ACTIVITY_PLAN(3,"月度活动计划表", "monthlyActivitySchedule.xlsx","/blankStencil/rally/月度活动计划表.xlsx","/blankStencil/rally/preview/月度活动计划表.png",true),
    VOLUNTEER_SERVICE_PROJECT(4,"志愿服务项目登记表", "volunteerForm.xlsx","/blankStencil/rally/志愿服务项目登记表.xlsx","/blankStencil/rally/preview/志愿服务项目登记表.png",true),
    VOLUNTARY_ACTIVITY(5,"志愿活动台账", "volunteerLedger.xlsx","/blankStencil/rally/志愿活动台账.xlsx","/blankStencil/rally/preview/志愿活动台账.png",true),
    A(6,"壹刻宝文化驿站活动台账", "ykbCultureStationBook.xlsx","/blankStencil/rally/壹刻宝文化驿站活动台账.xlsx","/blankStencil/rally/preview/壹刻宝.png",true),
    B(7,"新时代文明实践活动台账", "newcCultureActivityBook.xlsx","/blankStencil/rally/新时代文明实践活动台账.xlsx","/blankStencil/rally/preview/新时代文明实践.png",true),
    C(8,"综合性文化服务中心活动台账", "comCultureServiceCentre.xlsx","/blankStencil/rally/综合性文化服务中心活动台账.xlsx","/blankStencil/rally/preview/综合性文化服务.png",true);
    private  int code;
    private  String name;
    private  String templat;
    private  String templatUrl;
    private  String preview;
    private  boolean loopLable;
    public static String getTemplatName(String name){
        String templat = Arrays.asList(SqfwRallyEnums.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }
    public static SqfwRallyEnums getTemplatEnums(int code){
        SqfwRallyEnums sqfwRallyEnums = Arrays.asList(SqfwRallyEnums.values())
                .stream()
                .filter(e -> code ==e.getCode() )
                .collect(Collectors.toList())
                .get(0);
        return sqfwRallyEnums;
    }

    public static String getUrl(String name){
        PropertiesProxy conf=new PropertiesProxy();
        conf.get("huawei-oss.url");
        String url = Arrays.asList(SqfwRallyEnums.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplatUrl();
        return  conf.get("huawei-oss.url")+url;
    }

    public static void main(String[] args) {
        for (SqfwRallyEnums enumObj : SqfwRallyEnums.values()) {
            if (enumObj.isLoopLable()){
                System.out.println(enumObj);
            }

        }
    }


}